home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Science⁄Math / VideoToolbox / VideoToolboxSources / SetFileInfo.c < prev    next >
Text File  |  1993-09-14  |  1KB  |  55 lines

  1. /*
  2. SetFileInfo.c
  3.  
  4. USAGE
  5.  
  6.     SetFileInfo("Output File",'xxxx','yyyy');
  7.  
  8. ARGUMENTS
  9.  
  10.     char    *fileName;        The name of the file (including HFS
  11.                             directory name) to be set.
  12.     
  13.     OStype    'xxxx'            The four character file type, usually 'TEXT'
  14.  
  15.     OStype    'xxxx'            The four character creator, eg 'XCEL','CGRF','QKPT','QED1'
  16.  
  17. COMMENTS
  18.  
  19.     The syntax 'xxxx' results in four characters packed into a short int. This is
  20.     a Macintosh convention, not Standard C. That's ok since this routine is strictly
  21.     Macintosh anyway.
  22.  
  23. EXAMPLE
  24.  
  25.     ** create Cricket data file **
  26.     myFile=fopen("LuminanceCalibration.data","w");
  27.     SetFileInfo("LuminanceCalibration.data",'TEXT','CGRF');
  28.     fprintf(myFile,"*\n");
  29.     fprintf(myFile,"x\ty\n");
  30.     for(i=0;i<n;i++)fprintf(myFile,"%9g\t%9g\n",x[i],y[i]);
  31.     fclose(myFile);
  32.  
  33.     
  34. HISTORY
  35. 12/87    EJC wrote q_make_crick()
  36. 8/89    dgp Renamed and rewritten.
  37. 8/24/91    dgp    Made compatible with THINK C 5.0.
  38. 12/28/92 dgp Removed obsolete support for THINK C 4.
  39.  
  40. *****************************************************************************/
  41. #include "VideoToolbox.h"    /* for prototype of itself */
  42. #include <Files.h>
  43.  
  44. void SetFileInfo(char *fileName,OSType fileType,OSType fileCreator)
  45. {
  46.     FInfo outFileInfo;
  47.     
  48.     CtoPstr(fileName);
  49.     GetFInfo((StringPtr)fileName,0,&outFileInfo);
  50.     outFileInfo.fdType = fileType;
  51.     outFileInfo.fdCreator = fileCreator;
  52.     SetFInfo((StringPtr)fileName,0,&outFileInfo);
  53.     PtoCstr((void *)fileName);
  54. }
  55.